package lab02.test06;

import java.util.Scanner;

public class Triangle {
    //属性：三个边、周长、面积、boolean
    double edge1;
    double edge2;
    double edge3;
    double s=(edge1+edge2+edge1)/2;
    boolean Triangle;
    double perimeter;
    double area;
    //行为:返回周长、面积以及修改三个边
    double getPerimeter(){
        perimeter=edge1+edge2+edge3;
        System.out.println("三角形的周长："+perimeter);
        return perimeter;
       }
    double getArea(){
        double area=Math.sqrt(s*(s-edge1)*(s-edge2)*(s-edge3));
        System.out.println("三角形的面积："+area);
        return area;}
        boolean isTriangle(){
        if (edge1+edge2>edge3||edge1+edge3>edge2||edge2+edge3>edge1){
            System.out.println("这是一个三角形");
        }
        else {
            System.out.println("这不是一个三角形");
        }
        return Triangle;
        }
    //构造函数
    //main函数
    public static void main(String[] args) {
        Triangle triangle=new Triangle();
        triangle.edge1=3;
        triangle.edge2=4;
        triangle.edge3=5;
        triangle.getPerimeter();
        triangle.getArea();
        triangle.isTriangle();
    }
}
